package com.creditcmsplt.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 数据库操作DAO：creditlog表
 * @author Administrator
 *
 */
public interface CreditLogMapper{

	@Select("SELECT credit_queryid FROM t_credit_log WHERE idcard=#{idcard}  ORDER BY credit_time DESC LIMIT 1")
	public List<String> selectPDFByIdentity(@Param("idcard") String idcard);
	
	@Select(
			"SELECT credit_queryid FROM (" +
			"	SELECT " +
			"		rol2.credit_username csname,rol2.credit_id csid,rol4.credit_username ywname," +
			"		 rol4.credit_id ywid" +
			"	FROM t_credit_user rol4,t_credit_user  rol3,t_credit_user  rol2 " +
			"	WHERE rol4.credit_parentid=rol3.credit_id AND rol3.credit_parentid=rol2.credit_id " +
			"		AND rol4.credit_roleid=4" +
			"		AND rol3.credit_roleid=3" +
			"		AND rol2.credit_roleid=2" +
			") t,t_credit_log lo,t_credit_auoth au " +
			"WHERE " +
			"	lo.credit_userid=ywid " +
			"	AND au.user_id=t.csid" +
			"	AND au.vendor_key=#{vendor_key}" +
			"	AND au.vendor_secret=#{vendor_secret}" +
			"	AND lo.idcard=#{idcard}"
			)
	public List<String> checkIdentifyByCs(@Param("vendor_key") String vendor_key,@Param("vendor_secret") String vendor_secret,@Param("idcard") String idcard );
}
